package com.example.controller;

import com.example.entity.BootEntity;
import com.example.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class DemoController {

    @Autowired
    private DemoService service;
    @RequestMapping(value = "/addBoot")
    public int insertBott(BootEntity entity)
    {
        service.insertBoot(entity);
        return  entity.getId();
    }
    @RequestMapping(value = "/getBoot/{id}")
    public BootEntity getBoot(@PathVariable("id") int id)
    {
        return  service.getBootEntity(id);
    }
    @RequestMapping(value = "/deleteBoot/{id}")
    public void deleteBoot(@PathVariable("id") int id)
    {
         service.getBootEntity(id);
    }
    @RequestMapping(value = "/deleteAll/{id}")
    public void deleteAll(@PathVariable("id") int id)
    {
         service.deleteBootAndCar(id);
    }

}
